package com.itheima.dao.impl;


import com.itheima.dao.UserDao;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;

/**
 * @author 张义
 * @describe:
 * @date 2021/06/20
 */

@Repository("userDao")
public class UserDaoImpl implements UserDao {

    @Resource(name = "jdbcTemplate")
    private JdbcTemplate jdbcTemplate;

    public void out(String outMan, double money) {
        jdbcTemplate.update("update tb_user set money = money - ? where user_name = ?" , money , outMan);
    }

    public void in(String inMan, double money) {
        jdbcTemplate.update("update tb_user set money = money + ? where  user_name = ?" , money , inMan);
    }
}
